﻿<%@ Page MasterPageFile="~/Site.Master"  Language="C#" AutoEventWireup="true" CodeBehind="DiliveryCostStrategy.aspx.cs" Inherits="RabbitManage.UI.DiliveryCostStrategy" %>

<asp:Content runat="server" ID="BodyContent" ContentPlaceHolderID="MainContent">
    <form id="form1" action="../Action/DiliveryStrategyAdd.aspx" method="POST">

        <script type="text/javascript">

            form1.onsubmit = function (e) {
                // stop the regular form submission
                e.preventDefault();

                // collect the form data while iterating over the inputs
                var data = {};
                var provinceList = [];
                for (var i = 0, ii = form1.length; i < ii; ++i) {
                    var input = form1[i];
                    if (input.name) {
                        if (input.name == "selectedProvince") {
                            if (input.checked) {
                                provinceList.push(input.value);
                            }
                        }
                        else {
                            data[input.name] = input.value;
                        }
                    }
                }
                data["ProvinceList"] = provinceList;

                // construct an HTTP request
                var xhr = new XMLHttpRequest();
                xhr.open(form1.method, form1.action, true);
                xhr.setRequestHeader('Content-Type', 'application/json; charset=UTF-8');

                // send the collected data as JSON
                xhr.send(JSON.stringify(data));

                xhr.onloadend = function () {
                    // done
                    if (xhr.responseText == "true") {
                        window.location = "/UI/DiliveryCostStrategy.aspx";
                    } else {
                        alert(xhr.responseText);
                    }
                };
            };
        </script>
        <script type="text/javascript" src="../../RabbitShop/Scripts/city.js"></script>
        
        
        规则名称：
        <input type="text" id="inputStrategyName" name="StrategyName" style="width: 400px;" value="<%=stragegyName %>" />
        <br/>
        运费：
        <input type="text" id="inputCost" name="Cost" style="width: 40px; text-align: right;" value="<%=cost %>" />
        <br/>
        满包邮：
        <input type="text" id="inputGreaterThan" name="GreaterThan" style="width: 40px; text-align: right;" value="<%=cost %>" />
        <br/>
        省份：
        <input type="checkbox" name="selectAll"/>全选
        <br/>
    
        <asp:Repeater runat="server" ID="provinceRepeater" >
            <ItemTemplate>
                <input type="checkbox" name="selectedProvince" value="<%#Eval("Name") %>"/><%#Eval("Name") %>
                
            </ItemTemplate>
        </asp:Repeater>
                
        
        

<%--        <table>
            <tr>
                <td>
                    收件地址：
                    <select id="cmbProvince" name="Province" ></select>
                    <select id="cmbCity" name="City"></select>
                    <select id="cmbArea" name="Region"></select>
                    <br/>

                    <input type="text" id="inputCost" name="Cost" style="width: 540px;" value="<%=address.Detail %>"  />
                </td>
                
            </tr>
            <tr>
                <td>
                    收件人：
                    <input type="text" id="inputContactName" name="ContactName" style="width: 120px;" value="<%=address.ContactName %>" />
                    电话：
                    <input type="text" id="inputContactPhone" name="ContactPhone" style="width: 120px;" value="<%=address.ContactPhone %>" />
                    邮编：
                    <input type="text" id="inputPostalCode" name="PostalCode" style="width: 120px;" value="<%=address.PostalCode %>" />
                </td>
                
            </tr>

        </table>--%>
        
        <br/>
        <input type="submit" value="保存" />
        
        <script type="text/javascript">
            addressInit('cmbProvince', 'cmbCity', 'cmbArea', '<%=address.Province %>', '<%=address.City %>', '<%=address.Region %>');
        </script>
        

        <%--<table>

    
                    <asp:Repeater runat="server" ID="myRepeater" >
                        <ItemTemplate>
                            <tr>
                                
                            <td>
                                <%#Eval("Province") %>
                            </td>
                            <td>
                                <%#Eval("City") %>
                            </td>
                            <td>
                                <%#Eval("Region") %>
                            </td>
                            <td>
                                <%#Eval("Detail") %>
                            </td>
                            
                            <td>
                                <%#Eval("ContactName") %>
                            </td>
                            <td>
                                <%#Eval("ContactPhone") %>
                            </td>
                            <td>
                                <%#Eval("PostalCode") %>
                            </td>
                                
                                <td>
                                <a href="UserAddress.aspx?aid=<%#Eval("Id") %>">编辑</a>
                            </td>
                            <td>
                                <a href="../Action/AddressDelete.aspx?aid=<%#Eval("Id") %>" onclick="return confirm('确认删除？')">删除</a>
                            </td>

                            </tr>
                        </ItemTemplate>
                    </asp:Repeater>
                
            </table>--%>
    </form>
    
</asp:Content>
